package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.os.Bundle;
import android.view.View;

public class ToolBarActivity extends AppCompatActivity {

    private Toolbar mToolBar1, mToolBar2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tool_bar);
        mToolBar1 = findViewById(R.id.toolbar);
        mToolBar1.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        mToolBar2 = findViewById(R.id.toolbar2);
        mToolBar2.setTitle("ToolBar2");
        mToolBar2.setTitleMarginStart(20);
        mToolBar2.setNavigationIcon(R.drawable.ic_baseline_arrow_back_ios_24);
        mToolBar2.setSubtitle("subtitle");
        mToolBar2.setLogo(R.mipmap.ic_launcher);
        mToolBar2.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}